package com.shop.web;


import com.shop.domain.Items;
import com.shop.service.ItemService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.servlet.ModelAndView;

import java.util.List;

@Controller
public class ItemController {

    @Autowired
    private ItemService itemService;
    @RequestMapping(value = "/Item")
    public ModelAndView getItemList(){

        List<Items> itemList = this.itemService.getItemList();


        ModelAndView modelAndView = new ModelAndView();
        modelAndView.addObject("itemList",itemList);

        modelAndView.setViewName("itemList");
        return modelAndView;
    }
}
